{template '_header'}
<div class="page-header">
	当前位置：<span class="text-primary">编辑 记次时商品核销信息</small></span>
</div>
 <div class="page-content">
    <form {ife 'shop.verify.store' $item}action="" method="post"{/if} class="form-horizontal form-validate" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$verifygoods['id']}" />
                <div class="summary_box">
                    <div class="summary_title">
                        <span class="text-default title_inner">核销信息</span>
                    </div>
                    <div class="summary flex">
                        <div class="flex1 flex" style="border-right: 1px solid #efefef">
                            <img src="{php echo tomedia($verifygoods['thumb'])}" style="width:80px;height:80px;padding:1px;border:1px solid #ccc;"onerror="this.src='../addons/mx_shop/static/images/nopic.png'">
                            <div style="text-align: left;margin-left: 15px">
                                <p>记次时商品核销ID：{$item['id']}</p>
                                <p>商品名称：{$item['title']}</p>
                                <p>订单号：{$item['ordersn']}</p>
                            </div>
                        </div>
                        <div class="flex1 flex ">
                            <div style="text-align: left;margin-left: 50px">
                                <p>购买人：{$username}</p>
                                <p>手机号：{$mobile}</p>
                                <p>购买时间：{php echo date('Y-m-d H:i:s',$verifygoods['paytime'])}</p>
                            </div>
                        </div>

                    </div>
                </div>
        <div class="form-group-title">核销信息编辑</div>
         <div class="form-group">
             <label class="col-lg control-label">已核销次数</label>
             <div class="col-sm-9 col-xs-12">
                 <div class='form-control-static text-danger'>{$verifynum}</div>
             </div>
         </div>

         <div class="form-group">
             <label class="col-lg control-label">剩余核销次数</label>
             <div class="col-sm-9 col-xs-12">
                 <div class='form-control-static text-danger'>
                     {if !empty($item['limitnum'])}
                     {php echo $item['limitnum'] - $verifynum}
                     {else}
                     不限次数
                     {/if}
                 </div>
             </div>
         </div>
         <div class="form-group">
             <label class="col-lg control-label">有效期截止</label>
             <div class="col-sm-9 col-xs-12">
                 <div class='form-control-static text-danger'>{php echo  date('Y-m-d H:i:s',  intval($item['starttime']) +  $item['limitdays']*86400  )}</div>
             </div>
         </div>
     <div class="form-group">
         <label class="col-lg control-label">有效期类型</label>
         <div class="col-sm-9">
             {ife 'goods' $item}
             <label class="radio-inline"><input type="radio" onclick="$('.showverifydays').show();$('.showverifylimitdate').hide();"   name="limittype" value="0" {if empty($item['limittype']) }checked="true"{/if}  /> 购买后有效</label>
             <label class="radio-inline"><input type="radio" onclick="$('.showverifydays').hide();$('.showverifylimitdate').show();"   name="limittype" value="1" {if $item['limittype'] == 1}checked="true"{/if}   /> 指定过期日期</label>
             {else}
             <div class='form-control-static'>{if empty($item['limittype'])}购买后有效{else}指定过期日期{/if}</div>
             {/if}
         </div>
     </div>
     <div class="form-group showverifydays" {if !empty($item['limittype'])} style ='display:none;'{/if}>
         <label class="col-lg control-label">有效天数</label>
         <div class="col-sm-9 col-xs-12">
             {ife 'shop.verify.store' $item}
             <input type="text" name="limitdays" class="form-control" value="{$item['limitdays']}" data-rule-required="true" />
             <div class="help-block">设置为空或者0则默认为365天</div>
             {else}
             <div class='form-control-static'>{$item['limitdays']}</div>
             {/if}
         </div>
     </div>
     <div class="form-group showverifylimitdate" {if empty($item['limittype'])} style ='display:none;'{/if}>
             <label class="col-lg control-label">过期日期</label>
             <div class="col-sm-6 col-xs-12">
                 {ife 'goods' $item}
                 <div class="input-group">
                     {php echo tpl_form_field_date('limitdate', !empty($item['limitdate']) ? date('Y-m-d H:i',$item['limitdate']) : date('Y-m-d H:i'),true)}
                 </div>
                 <span class="help-block">无论何时购买此商品,到达指定时间后都将过期,无法核销.</span>
                 {else}
                 <div class="col-sm-4 col-xs-6">
                     <div class='form-control-static'>
                         {php echo date('Y-m-d H:i',$item['limitdate'])}}
                     </div>
                 </div>
                 {/if}
             </div>
         </div>

        <div class="form-group">
            <label class="col-lg control-label">可核销次数</label>
            <div class="col-sm-9 col-xs-12">
                {ife 'shop.verify.store' $item}
                    <input type="text" name="limitnum" class="form-control" value="{$verifygoods['limitnum']}" data-rule-required="true" />
                    <div class="help-block">设置为空或者0则为不限制核销次数</div>
                {else}
                    <div class='form-control-static'>{$item['limitnum']}</div>
                {/if}

            </div>
        </div>

        <div class="form-group">
            <label class="col-lg control-label">是否有效</label>
            <div class="col-sm-9 col-xs-12">
                {ifp 'store.verifygoods.detail'}
                    <label class="radio-inline">
                        <input type="radio" value="0" name='invalid' {if empty($item['invalid'])}checked{/if} /> 有效
                    </label>
                    <label class="radio-inline">
                        <input type="radio" value="1" name='invalid' {if !empty($item['invalid'])}checked{/if} /> 无效
                    </label>
                {else}
                    <div class='form-control-static'>{if empty($item['invalid'])}有效{else}无效{/if}</div>
                {/if}
            </div>
        </div>

        <div class="form-group"></div>
        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
               {ife 'store.verifygoods.detail' $item}
                    <input type="submit" value="提交" class="btn btn-primary"  />
                {/if}
               <input type="button" name="back" onclick='history.back()' {ifp 'shop.verify.store.add|shop.verify.store.edit'}style='margin-left:10px;'{/if} value="返回列表" class="btn btn-default" />
            </div>
        </div>
 </form>
 </div>
{template '_footer'}